package lottery;

import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;

public class LotteryGameWSClientFactory {
	
	public static void main(String args[]) throws Exception{
		RemoteLotteryGameService create = create("http://localhost:9080/lottery-api-0.0.1-SNAPSHOT/LotteryGameWebService");
	}	
	
	public static RemoteLotteryGameService create(String endpoint_address) {
		QName serviceName = new QName("http://lottery/", "LotteryGameWebServiceService");
		String classpathWsdlLocation = "/LotteryGameWebService.wsdl";

		Service service = Service.create(RemoteLotteryGameService.class.getResource(classpathWsdlLocation), serviceName);
		RemoteLotteryGameService client = service.getPort(RemoteLotteryGameService.class);
		Map<String, Object> requestContext = ((BindingProvider) client).getRequestContext();
		requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,endpoint_address);

		return client;
	}
}